]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ScreenShield: consolidate code that handles dialog cancellation
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 8 Jun 2013 17:04:36 +0000 (19:04 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Wed, 7 Aug 2013 08:33:15 +0000 (10:33 +0200)
This way we ensure the same behavior everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=701731

js/ui/screenShield.js

index b5e274347fa26118dd3450020eecb0772ff55c28..b99645e237df1671b6309cbd40dcea0cce01c48b 100644 (file)
@@ -591,6 +591,21 @@ const ScreenShield = new Lang.Class({
         }
     },
 
+    _maybeCancelDialog: function() {
+        if (!this._dialog)
+            return;
+
+        this._dialog.cancel();
+        if (this._isGreeter) {
+            // LoginDialog.cancel() will grab the key focus
+            // on its own, so ensure it stays on lock screen
+            // instead
+            this._lockScreenGroup.grab_key_focus();
+        } else {
+            this._dialog = null;
+        }
+    },
+
     _becomeModal: function() {
         if (this._isModal)
             return true;
@@ -746,13 +761,7 @@ const ScreenShield = new Lang.Class({
                                onCompleteScope: this,
                              });
 
-            // If we have a unlock dialog, cancel it
-            if (this._dialog) {
-                this._dialog.cancel();
-                if (!this._isGreeter) {
-                    this._dialog = null;
-                }
-            }
+            this._maybeCancelDialog();
         }
     },
 
@@ -760,12 +769,7 @@ const ScreenShield = new Lang.Class({
         if (status != GnomeSession.PresenceStatus.IDLE)
             return;
 
-        if (this._dialog) {
-            this._dialog.cancel();
-            if (!this._isGreeter) {
-                this._dialog = null;
-            }
-        }
+        this._maybeCancelDialog();
 
         if (this._lightbox.actor.visible ||
             this._isActive) {